The present invention relates to the field of computer controlled graphics display systems. More specifically, the present invention relates to computer controlled graphics display systems utilizing texture mapping and lighting graphics techniques.
Computer controlled graphics systems are used for displaying graphics objects on a display. These graphics objects may comprise graphics primitive elements (xe2x80x9cgraphics primitivesxe2x80x9d) which include points, lines, polygons, etc. The graphics primitives may be used to render a two-dimensional (2D) image of a three-dimensional (3D) object on a display screen. Although the displayed image is 2D, it depicts a 3D scene. In the process of rendering 3D graphics, many techniques are used to create realistic 3D effects. Some of these techniques involve Gouruad shading, texture mapping, bilinear filtering, specular lighting, and fogging effects. Texture mapping refers to techniques for adding surface detail to areas or surfaces of these 3D graphics objects displayed on a 2D display. Often texture map information is added to polygon primitives.
Generally, texture mapping occurs by accessing encoded surface detail points or xe2x80x9ctexelsxe2x80x9d from a texel map memory space (xe2x80x9ctexel mapxe2x80x9d) which stores the surface detail, and transferring the surface detail texels to predetermined points of the graphics primitive (e.g., polygon primitive) to be texture mapped. The process of determining the proper texels which correspond to pixels is called sampling the texture map. The texture image within a texture map may be represented in computer memory as a bitmap or other raster-based encoded format. In memory, texels reside and are thereby accessed in a (u, v) texture coordinate space. However, the display screen includes point elements (pixels) which reside in an (x, y) display coordinate space. Therefore, texture mapping applies color or visual attributes of texels of the (u, v) texture map to corresponding pixels of the graphics object (primitive) on the display screen. Color values for pixels in (x, y) display coordinate space are determined based on sampled texture map values.
After texture mapping, the picture stored in the texture map is applied (or wapped) onto the graphics primitive. Because the original graphics object is 3D, texture mapping often involves maintaining certain perspective attributes with respect to the surface detail added to the object. Therefore, the rate in which a texture map is sampled, e.g., by du and dv values, is different depending on the perspective and size of the polygon. Perspective on the object can therefore distort the texture image.
Another process used to create realistic three dimensional objects in a computer display system, in addition to texture mapping, is lighting. In many graphics systems, light modifies the shading of the color associated with texture map data used during texture mapping and varies depending on the relative screen position of the texture map data with respect to any relevant light sources. Currently, texture map data displayed within a single primitive is lit uniformly using prior art display processes. Currently, there exists no known mechanism for lighting up regions of a texture map within a single graphics primitive and also simulating lights, indicator bulbs or glowing regions on the texture map which remain unaffected by external light sources (e.g., the sun, moon or darkness of night) within a three dimensional scene. This is the case because lighting processes are applied uniformly over all texels of a graphics primitive.
For example, FIG. 1 illustrates an exemplary three-dimensional graphic image 10 displayed on a two-dimensional display screen in a computer controlled graphics display system. Within the image 10 is shown a building 12, having multiple back-lighted windows 16a-16e and a light source 14. The effect of light from an external light source (e.g., the moon, the sun, etc.), not shown in FIG. 1, can also be included in image 10. Any of the objects of image 10 can include texture maps displayed therein. In this depiction, it is assumed that the building 10 contains lit windows 16a-16e that should be visualized in the darkness of night. Assume the image 10 is also to be displayed with the afternoon sun overhead.
One prior art method of simulating the above scenes is to use a single graphic object to represent the building 12 and to use a single texture map within the black building 12; the single texture map would include regions defined therein for the yellow windows 16a-16e. Lighting conditions are then applied to the texture data. In accordance with this prior art graphics display technique, when the building is viewed in darkness, since little external light is applied, the windows 16a-16e will not appear to be back-lit very strongly and the result is not a very realistic evening scene because the windows 16a-16e should be brighter. Moreover, when this building 12 is exposed to an external light source (e.g., the sun), the widows 16a-16e and the lamp 14 become lit even brighter and the building 12 still appears dark in the daylight. However, the desired or xe2x80x9crealisticxe2x80x9d image should show the windows 16a-16e remaining constant in brightness and the building becoming lighter. The reason these resulting images do not appear xe2x80x9crealisticxe2x80x9d using this prior art mechanism is largely an outcome of the lighting process acting uniformly over all texel data of the texture map for a given graphics primitive (e.g., the building).
Another prior art method of simulating the above effect is to use separate geometric primitives for the windows 16a-16e which are different from the graphic primitive used for the building 12. Because separate geometric primitives are used for these display regions, the rendering processes can non-uniformly apply lighting to these display regions. Although this prior art mechanism can yield the desired xe2x80x9crealisticxe2x80x9d image, it consumes more processing time because more geometric primitives are required to render the image 10. More geometric primitives also translate into more computer processing time thereby making this technique slower. Also, the description of the image 10 (e.g., the display list) becomes more complex due to the addition of the extra geometric primitives, thereby requiring more memory to store and implement image 10.
Accordingly, what is desired is to have a constant color on some objects of a three dimensional scene (e.g., constant with respect to the external light conditions) while allowing variable color shading on the other objects (e.g., variable with respect to the external light conditions) of the three-dimensional scene without requiring an undue amount of processing time or consuming an undue amount of memory resources.
Accordingly, the present invention provides a graphics system and method for providing a constant color on some objects of a three-dimensional scene (e.g., constant with respect to the external light conditions) while allowing variable color shading on the other objects (e.g., variable with respect to the external light conditions) of the three-dimensional scene without requiring an undue amount of processing time or memory resource consumption. More specifically, the present invention provides the above advantageous functionality within a system that utilizes texture map data displayed in a graphics primitive that can be non-uniformly lit from an external light source. These and other advantages of the present invention not described above will become clear in view of the following detailed description of the present invention.
A method and system are described herein for performing enhanced lighting functions with respect to texture map data. The present invention is operable within a computer controlled graphics display system and allows defined portions of a texture map to bypass prescribed lighting processes thereby avoiding the application of lighting conditions to these portions of the texture map data. The present invention therefore adds increased lighting options and capability to the texture map data. Within a texture map, each texel (u, v) is defined to contain color information and a control bit (xe2x80x9ctexel light bitxe2x80x9d). The texel light bit indicates to the lighting processes of the present invention whether or not texel color modulation is to occur to this texel. In one embodiment, if the texel light bit is set, then no lighting modifications (e.g., color modulations) are performed with respect to the texel data. Also, if the texel light bit is not set, then normal lighting modifications are performed with respect to the texel data. In this way, the present invention allows texture map data to be lit in a non-uniform manner across the texture image for a given graphics primitive. This is particularly useful with respect to graphic objects (e.g., lights, indicator bulbs, glowing regions of the texture map) that should remain unaffected by external light sources (e.g., the sun, the moon, darkness of the night) within a three-dimensional graphic scene while adjacent texture map images should respond to lighting conditions. By defining certain texture map regions as having xe2x80x9ctexel lights,xe2x80x9d the present invention then bypasses the external lighting conditions applied to the display scene for these regions.
Specifically, in a computer controlled graphics display system, an embodiment of the present invention includes a method of displaying a graphics image comprising the steps of: a) accessing a memory unit to obtain a graphics primitive; b) translating the graphics primitive into a plurality of pixels each having a two-dimensional display coordinate; and c) displaying the graphics primitive on a display screen, the step c) comprising the steps of: c1) for a respective pixel, obtaining from a texture map a corresponding texel, the corresponding texel comprising a control bit and a color value and having a two dimensional texel coordinate; c2) responsive to the control bit, selectively performing a lighting operation to modify the color value of the corresponding texel based on a lighting condition, the step c2) bypassing the lighting operation for the corresponding texel provided the control bit is of a first value; c3) displaying the respective pixel on the display screen with the color value of the corresponding texel; and c4) repeating the steps c1)-c3) for each of the plurality of pixels of the graphics primitive.
Embodiments include the above and wherein the lighting condition is a value dependent on an amount of light within a three dimensional graphic scene to be displayed on the display screen, the graphics primitive being part of the three dimensional graphic scene, and wherein the lighting operation of the step c2) comprises the step of multiplying the lighting condition with the color value of the corresponding texel. Embodiments also include a system implemented in accordance with the above.